<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- 上述3个meta标签*必须*放在最前面，任何其他内容都*必须*跟随其后！ -->
    <title>登入</title>

    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css" integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">

    <!-- HTML5 shim 和 Respond.js 是为了让 IE8 支持 HTML5 元素和媒体查询（media queries）功能 -->
    <!-- 警告：通过 file:// 协议（就是直接将 html 页面拖拽到浏览器中）访问页面时 Respond.js 不起作用 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.jsdelivr.cn/npm/html5shiv@3.7.3/dist/html5shiv.min.js"></script>
    <script src="https://cdn.jsdelivr.cn/npm/respond.js@1.4.2/dest/respond.min.js"></script>
    <![endif]-->
    <script src="js/jquery-3.3.1.js"></script>
    <script>

        $(function (){
            $("#sub").click(function (){
                var username=$("#username").val();
                var password=$("#password").val();
                var ms="账号或密码错误！";
                //alert(username+"============>"+password);
                $.get("login/login",{username:username,password:password},function (data){
                    if (data.flag){
                        location.href="student_list.html";
                    }else {
                        $("#msg").html(ms);
                    }
                });
            });
        })
    </script>
</head>
<body>
<div class="col-md-6 col-md-offset-3">
<div class="text-center">
    <h1>登入界面</h1>
    <div class="form-group">
    <input id="username" class="form-control" type="text" name="username" placeholder="请输入账号"><br/>
    </div>
    <div class="form-group">
    <input id="password" class="form-control" type="password" name="password" placeholder="请输入密码"><br/>
    </div>
    <button id="sub" type="button" class="btn btn-default sub">提交</button>
    <div id="msg"></div>
</div>
</div>
</body>
</html>